var editCategory = function (rowid, row, c, d) {
    var opt = $.extend({
        title: '新增',
        cancel: true,
        height: 500,
        width: 400,
        button: [{
            name: '保存',
            class: "btn-outline-primary",
            submit: true,
            close: true,
            toolbar: $(".nr-toolbar").toolbar(),
            click: function (e, iframe) {
            },
            callback: function () {

            }
        },]
    },
        {}
    );
    sy.open(sy.url({ a: 'editCategory', param: { 'id': rowid } }), opt);
};

$(document).ready(function(){
$('.nr-toolbar').toolbar('setFuncs', {
    addCategory: function (rowid, iRow, iCol, e) {
        var that = this;
        var opt = $.extend({
            title: '新增',
            cancel: true,
            height: 500,
            width: 400,
            button: [{
                name: '保存',
                class: "btn-outline-primary",
                submit: true,
                close: true,
                toolbar: that,
                click: function (e, iframe) {

                },
                callback: function () {

                }
            },]
        },
            {}
        );
        sy.open(sy.url({ a: 'addCategory' }), opt);
    }
    , editCategory: function () {

        var rowid = this.grid.jqGrid('getGridParam', 'selrow');
        editCategory(rowid);
    }, refreshCategory: function () {
        this.grid.trigger('reloadGrid', [{
            datatype: 'json'
        }]);
    }
}
);
})